<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
    <title>Document</title>
  
  </head>
  <body>
    <div id="app">
      绑定a属性
      <input type="text" v-model="obj.a">
      {{obj.a}}
      <hr>
      绑定b属性
      <input type="text" v-model="obj.b">
      {{obj.b}}
    </div>
    <script src="./vue.global.js"></script>
    <script>
      const { createApp } = Vue;
      const app = createApp({
        data() {
          return {
            obj: {
              a: 'a属性',
              b: 'b属性'
            }
          };
        },
        watch: {
          obj: {
            handler(newVal){
              console.log('obj改变了值是', newVal);
            },
            deep: true
          },
          "obj.a"(newVal){
            console.log('obj的a属性变化了值是', newVal);
          }
        }
      });
      app.mount("#app");
    </script>
  </body>
</html>
